package com.fas.system.mapper;

import com.fas.system.domain.FasBuilding;
import com.fas.system.domain.FasFacilities;
import com.fas.system.domain.vo.BuildingTreeFacility;
import com.fas.system.domain.vo.FacilityDataItemVo;
import com.fas.system.domain.vo.InspectionLineBuildingFacilityVo;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 设施信息Mapper接口
 *
 * @author ruoyi
 * @date 2022-05-05
 */
public interface FasFacilitiesMapper
{
    /**
     * 查询设施信息
     *
     * @param id 设施信息主键
     * @return 设施信息
     */
    public FasFacilities selectFasFacilitiesById(Long id);

    /**
     * 查询设施信息列表
     *
     * @param fasFacilities 设施信息
     * @return 设施信息集合
     */
    public List<FasFacilities> selectFasFacilitiesList(FasFacilities fasFacilities);

    /**
     * 新增设施信息
     *
     * @param fasFacilities 设施信息
     * @return 结果
     */
    public int insertFasFacilities(FasFacilities fasFacilities);

    /**
     * 修改设施信息
     *
     * @param fasFacilities 设施信息
     * @return 结果
     */
    public int updateFasFacilities(FasFacilities fasFacilities);

    /**
     * 删除设施信息
     *
     * @param id 设施信息主键
     * @return 结果
     */
    public int deleteFasFacilitiesById(Long id);

    /**
     * 批量删除设施信息
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteFasFacilitiesByIds(Long[] ids);

    List<FasFacilities> findLikeFacility(FasFacilities fasFacilities);

    List<FasFacilities> findAllFacility(FasFacilities fasFacilities);

    List<FasFacilities> facilityDetails(Integer id);

    Long countFasFacilities(FasFacilities fasFacilities);

    /**
     * 通过设施id绑定路线
     * @param facilityIds 被更新的设施id
     * @param routeId 路线id
     * @return
     */
    int batchUpdateInspectionLine(@Param("facilityIds") List<Integer> facilityIds,@Param("routeId")  Long routeId);

    /**
     * 查询线路上的设施
     * @param belongRoute 所属线路id
     * @return
     */
    List<FasFacilities> findByLineId(String belongRoute);

    /**
     * 删除巡检路线下的设施
     * @param ids
     */
    int batchDeleteRoute(@Param("ids") Long[] ids);

    /**
     * 统计路线下多少个设施
     * @param belongRoute
     * @return
     */
    int routeCount(Integer belongRoute);

    List<FasBuilding> miniappFindIpqcBuilding(Long lineId);

    List<FacilityDataItemVo> miniappIpqcLineBuildingFacility(@Param("facilityId")Integer facilityId,@Param("taskId") Long taskId);

    List<BuildingTreeFacility > selectByBuilding(InspectionLineBuildingFacilityVo inspectionLineBuildingFacilityVo);

    /**
     * 查询设备编号是否已经存在数据库
     * @param facilityNumber    设施编号
     * @return
     */
    int exists(String facilityNumber);

    /**
     * 批量插入设施
     * @param fasFacilitiesList
     * @return
     */
    int batchInsert(@Param("list") List<FasFacilities> fasFacilitiesList);

    int existsFacilitiesType(Integer fasFacilitiesTypeId);

    int existsInspectionLine(Long lineId);
}
